package com.wjk.kylin.mall.product.enums;

import org.apache.commons.lang3.StringUtils;

public enum ProductDataSyncEsTableEnum {
    MALL_PRODUCT("t_product", "id"),

    ;
    private String value;
    //sku id 字段
    private String productIdField;

    ProductDataSyncEsTableEnum(String value, String productIdField) {
        this.value = value;
        this.productIdField = productIdField;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getProductIdField() {
        return productIdField;
    }

    public void setProductIdField(String productIdField) {
        this.productIdField = productIdField;
    }

    /**
     * 根据 value 获取枚举
     *
     * @param value
     * @return
     */
    public static ProductDataSyncEsTableEnum getByValue(String value) {
        if (StringUtils.isNotBlank(value)) {
            for (ProductDataSyncEsTableEnum tableEnum : ProductDataSyncEsTableEnum.values()) {
                if (value.equals(tableEnum.getValue())) {
                    return tableEnum;
                }
            }
        }
        return null;
    }
}
